
import { createI18n } from "vue-i18n";
import { useUserInfo } from "@/libs/useUserInfo";
import { getCurrentLanguage } from "@/libs/useLanguageEnum";
import * as source from "./source";

const messages = {
  "ZH-HANT" : source.zh_hant,
  "EN": source.en,
  "ZH-CN": source.zh_cn,
}

const i18n = createI18n({
  locale: useUserInfo().value?.setting?.languageCode || getCurrentLanguage(), // 设置当前语言类型
  legacy: false, // 如果要支持compositionAPI，此项必须设置为false;
  globalInjection: true, // 全局注册$t方法
  messages
})

export default i18n;